package com.itheima.controller;

import com.itheima.anno.Log;
import com.itheima.pojo.CountOption;
import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;

import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j// 日志
@RestController//
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;


    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("开始处理员工职位数据统计");
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("统计员工性别信息");
        List<Map> genderList = reportService.getEmpGenderData();
        return Result.success(genderList);
    }

    @GetMapping("studentDegreeData")
    public Result getStudentDegreeData(){
        log.info("统计员工学历信息");
        List<Map> degreeList = reportService.getStudentDegreeData();
        return Result.success(degreeList);
    }

    @GetMapping("studentCountData")
    public Result getStudentCountData(){
        log.info("统计每一个班级的人数");
        CountOption countList = reportService.getStudentCountData();
        return Result.success(countList);
    }
}
